<#include "/@inc/funcMacros.ftl">

<#--  Function Macros for IDL IMPLementation .h/.cpp files -->

<#macro GET_CAA_INTERFACE attr LT="" >
		// Gets a pointer on CATISpecAttrAccess
		CATISpecAttrAccess_var spiSpecAttrAccess = this ;
		if ( NULL_var == spiSpecAttrAccess)
		{
			return E_FAIL ;
		}

		// Gets a pointer on the ${LT}::${attr.name} attribute
		CATISpecAttrKey *piSpecAttrKey = spiSpecAttrAccess->GetAttrKey("${attr.name}");
		if ( NULL == piSpecAttrKey )
		{
			return E_FAIL ;
		}
</#macro>

<#--  Adds a tk_xxx attribue Get/Set functions DECLaration
IDL function
    HRESULT __stdcall get_Point2(CATIAReference *& opiReferenceOnPoint2);
    HRESULT __stdcall put_Point2(CATIAReference *  ipiReferenceOnPoint2);
 * @param attr
 *  attribute data type with {name, type, facet } info}
-->
<#macro IDL_IMP_GET_FUNC_DECL_COMMON  attr clsName="" ftype ="">
<#if ( attr.type?length == 0 ) >
	 /**
	 * ${clsName}${attr.name}
	 * S_OK if successfull else E_FAIL.
	 */
	HRESULT ${clsName}${attr.name}() ${ ftype} ;
<#elseif x.tk_type == attr.type>
	 /**
	 * ${clsName}Get${attr.name}
	 * @param o${x.prefix}${attr.name}
	 *
	 * @return
	 * S_OK if successfull else E_FAIL.
	 */
	 HRESULT __stdcall get_${attr.name}(  ${x.IDLtype}  & o${x.prefix}${attr.name})  ${ ftype} ;
</#if>
</#macro>

<#--  Adds a tk_xxx attribue Set function DECLaration
 * @param attr
 *  attribute data type with {name, type, facet } info}
-->
<#macro IDL_IMP_SET_FUNC_DECL_COMMON  attr clsName="" fqual="" ftype ="">
<#list Types as t><#t> <#if t.tk_type == attr.type> <#assign x = t> <#break></#if></#list>
	 /**
	 * ${clsName}Set${attr.name}
	 * @param ${x.prefix}${attr.name}
	 *
	 * @return
	 * S_OK if successfull else E_FAIL.
	 */
	 HRESULT __stdcall put_${attr.name}(  ${x.qual} ${x.IDLtype}  ${x.setPrefix}${attr.name})  ${ ftype} ;
</#macro>

<#--  Adds a tk_xxx attribue Get/Set functions DECLaration
 * @param attr
 *  attribute data type with {name, type, facet } info}
-->
<#macro IDL_IMP_FUNC_DECL  attr clsName="" >
<#switch attr.type>
<#case "">
<@IDL_IMP_GET_FUNC_DECL_COMMON attr clsName  />
<#return>
<#case "tk_string">
<#case "tk_component">
<#case "tk_specobject">
<#list Types as t><#t> <#if t.tk_type == attr.type> <#assign x = t> <#break></#if></#list>
	 HRESULT __stdcall get_${attr.name}(  ${x.IDLtype}  *& o${x.prefix}${attr.name})  ;
<#break>
<#default>
<@IDL_IMP_GET_FUNC_DECL_COMMON attr clsName  />
</#switch>
<@IDL_IMP_SET_FUNC_DECL_COMMON attr clsName  />
</#macro>

<#--  adds a tk_list(tk_xxx) attribue Get/Set functions DECLaration
 * @param attr
 *  LIST attribute data type with {name, type, facet } info}
-->
<#macro IDL_IMP_LIST_FUNC_DECL  attr clsName="", pvirtual ="n">
<#list ListTypes as t> <#if t.tk_type == attr.type> <#assign x = t> <#break></#if></#list>
 
	 /**
	 * Get${attr.name}
	 * @param oList${attr.name}
	 *
	 * @return  S_OK if successfull else E_FAIL.
	 */
	 HRESULT __stdcall Get${attr.name}(  	  CATSafeArrayVariant  *& oList${attr.name})  ;
	 
	 /**
	 * Set${attr.name}
	 * @param iList${attr.name}
	 *
	 * @return S_OK if successfull else E_FAIL.
	 */
	 HRESULT __stdcall Set${attr.name}( const CATSafeArrayVariant  & iList${attr.name}) ;
<#if x.type == "CATListValCATISpecObject_var">
	 /**
	 * ${clsName}Add${attr.name}
	 * @param ipSpec${attr.name}
	 *
	 * @return
	 * S_OK if successfull else E_FAIL.
	 */
	 HRESULT __stdcall ${clsName}Add${attr.name}( CATIAReference * ipSpec${attr.name} ) ;

	 /**
	 * ${clsName}Remove${attr.name}
	 * @param ipSpec${attr.name}
	 *
	 * @return
	 * S_OK if successfull else E_FAIL.
	 */
	 HRESULT __stdcall ${clsName}Remove${attr.name}( CATIAReference * ipSpec${attr.name}) ;
</#if>
</#macro>

